package entity

import "encoding/json"

type UpgradePlan struct {
	Id           int64           `gorm:"column:id;primary_key" json:"id"`
	StrategyId   int64           `gorm:"column:strategy_id;type:bigint;not null" json:"strategy_id"`
	Name         string          `gorm:"column:name;type:varchar(255);not null" json:"name"`
	Detail       json.RawMessage `gorm:"column:detail;type:json;not null" json:"detail"`
	TargetType   int             `gorm:"column:target_type;type:integer;not null" json:"target_type"`
	UpgradeType  int             `gorm:"column:upgrade_type;type:integer;not null" json:"upgrade_type"`
	QueryCond    json.RawMessage `gorm:"column:query_cond;type:json;not null" json:"query_cond"`
	StartTime    int64           `gorm:"column:start_time;type:bigint;not null" json:"start_time"`
	FailureCount int             `gorm:"column:failure_count;type:integer;not null" json:"failure_count"`
	SuccessCount int             `gorm:"column:success_count;type:integer;not null" json:"success_count"`
	TotalCount   int             `gorm:"column:total_count;type:integer;not null" json:"total_count"`
	Status       int             `gorm:"column:status;type:integer;not null" json:"status"`
	Overseer     string          `gorm:"column:overseer;type:varchar(255);not null" json:"overseer"`
	Tester       string          `gorm:"column:tester;type:varchar(255);not null" json:"tester"`
	Inspector    string          `gorm:"column:inspector;type:varchar(255);not null" json:"inspector"`
	Operator     int64           `gorm:"column:operator;type:bigint;not null" json:"operator"`
	OperatorName string          `gorm:"column:operator_name;type:varchar(255);not null" json:"operator_name"`
	CreatedAt    int64           `gorm:"column:created_at;type:bigint;not null" json:"created_at"`
	UpdatedAt    int64           `gorm:"column:updated_at;type:bigint;not null" json:"updated_at"`
}

func (u *UpgradePlan) TableName() string {
	return "upgrade_plan"
}
